From 830b8af425ed83e7d94d561ea8ad9fcb184c3cb7 Mon Sep 17 00:00:00 2001 From: Andy Russell Date: Fri, 2 Dec 2016 15:28:40 -0500 Subject: [PATCH] remove unused argument to `Context::lib_profile` --- src/cargo/ops/cargo_rustc/context.rs | 14 +++++++------- src/cargo/ops/cargo_rustc/custom_build.rs | 2 +- src/cargo/ops/cargo_rustc/job_queue.rs | 4 +--- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/cargo/ops/cargo_rustc/context.rs b/src/cargo/ops/cargo_rustc/context.rs index 09977ca30..b1690755f 100644 --- a/src/cargo/ops/cargo_rustc/context.rs +++ b/src/cargo/ops/cargo_rustc/context.rs @@ -597,7 +597,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> { Ok(Unit { pkg: pkg, target: t, - profile: self.lib_profile(id), + profile: self.lib_profile(), kind: unit.kind.for_target(t), }) }) @@ -630,7 +630,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> { Unit { pkg: unit.pkg, target: t, - profile: self.lib_profile(id), + profile: self.lib_profile(), kind: unit.kind.for_target(t), } })); @@ -707,7 +707,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> { ret.push(Unit { pkg: dep, target: lib, - profile: self.lib_profile(dep.package_id()), + profile: self.lib_profile(), kind: unit.kind.for_target(lib), }); if self.build_config.doc_all { @@ -753,7 +753,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> { Unit { pkg: unit.pkg, target: t, - profile: self.lib_profile(unit.pkg.package_id()), + profile: self.lib_profile(), kind: unit.kind.for_target(t), } }) @@ -808,7 +808,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> { /// Number of jobs specified for this build pub fn jobs(&self) -> u32 { self.build_config.jobs } - pub fn lib_profile(&self, _pkg: &PackageId) -> &'a Profile { + pub fn lib_profile(&self) -> &'a Profile { let (normal, test) = if self.build_config.release { (&self.profiles.release, &self.profiles.bench_deps) } else { @@ -821,10 +821,10 @@ impl<'a, 'cfg> Context<'a, 'cfg> { } } - pub fn build_script_profile(&self, pkg: &PackageId) -> &'a Profile { + pub fn build_script_profile(&self, _pkg: &PackageId) -> &'a Profile { // TODO: should build scripts always be built with the same library // profile? How is this controlled at the CLI layer? - self.lib_profile(pkg) + self.lib_profile() } pub fn rustflags_args(&self, unit: &Unit) -> CargoResult> { diff --git a/src/cargo/ops/cargo_rustc/custom_build.rs b/src/cargo/ops/cargo_rustc/custom_build.rs index e412b846e..5c697e928 100644 --- a/src/cargo/ops/cargo_rustc/custom_build.rs +++ b/src/cargo/ops/cargo_rustc/custom_build.rs @@ -97,7 +97,7 @@ fn build_work<'a, 'cfg>(cx: &mut Context<'a, 'cfg>, unit: &Unit<'a>) // environment variables. Note that the profile-related environment // variables are not set with this the build script's profile but rather the // package's library profile. - let profile = cx.lib_profile(unit.pkg.package_id()); + let profile = cx.lib_profile(); let to_exec = to_exec.into_os_string(); let mut cmd = cx.compilation.host_process(to_exec, unit.pkg)?; cmd.env("OUT_DIR", &build_output) diff --git a/src/cargo/ops/cargo_rustc/job_queue.rs b/src/cargo/ops/cargo_rustc/job_queue.rs index 5e35a7e10..f06a0bbeb 100644 --- a/src/cargo/ops/cargo_rustc/job_queue.rs +++ b/src/cargo/ops/cargo_rustc/job_queue.rs @@ -198,9 +198,7 @@ impl<'a> JobQueue<'a> { } let build_type = if self.is_release { "release" } else { "debug" }; - let profile = cx.ws.current_opt().map_or_else(Profile::default, |p| { - cx.lib_profile(p.package_id()).to_owned() - }); + let profile = cx.lib_profile(); let mut opt_type = String::from(if profile.opt_level == "0" { "unoptimized" } else { "optimized" }); if profile.debuginfo { -- 2.30.2